package views
{
	import inerface.INavigatonPosChoose;
	
	import main.ClientConstants;
	import main.ViewSubBase;
	
	import panel.viewSpots.navigationNew.NavigationPosChoosePanel;
	
	public class NavigatonPosChooseView extends ViewSubBase
	{
		private var _panel:INavigatonPosChoose;
		public function NavigatonPosChooseView()
		{
			super();
		}
		
		public override function show():void
		{
			data.viewSpot.loadViewSpotData(render);
		}
		
		protected override function render():void
		{
			if(!_panel)
			{
				_panel = new NavigationPosChoosePanel();
				_panel.init(this.layout.stage,this.resourceLoader,this.lang,this.data.uri);
				_panel.openDetail = view.viewSpotDetail.showData;
				_panel.openNavigation = showNavigation;
			}
			_panel.show(this.data.viewSpot.viewSpotsData.spotList);
			this.addView(_panel);
		}
		
		private function showNavigation(info:Object):void
		{
			if(info.map == "0")
			{
				view.viewSpotDetail.showData(info,ClientConstants.DETAIL_VIEWSPOT);
				return;
			}
			view.navigationTypeChoose.showData(info);
		}
		
		public override function clear():void
		{
			this.closeView(this);
			if(_panel)
			{
				_panel.clear();
			}
			_panel = null;
		}
		
	}
}